<!DOCTYPE html>
<html>
<head>
	<title>取货助手 -- 小跳蛙快递驿站服务平台</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<link href="../../backend/css/normalize.css" type="text/css" rel="stylesheet" />
	<link href="../../backend/css/common.css" type="text/css" rel="stylesheet" />
	<script src="../../backend/js/jquery.min.js" type="text/javascript"></script>
	<script src="../../backend/js/common.js" type="text/javascript"></script>
	<script src="../../backend/js/notice.js" type="text/javascript"></script>
	<script src="../../backend/js/regexp.js" type="text/javascript"></script>
	<script src="../../backend/js/jweixin-1.2.0.js" type="text/javascript"></script>
	<script src="../../backend/layer/layer.js"></script>
	<script type="text/javascript">
	var number = null;
	function find(){
		var windowId = layer.load();
		var number = $("#expPickUserId").val();
		$.getJSON("/wx/indexQueryExpress.do",{number:number},function(data){
			layer.close(windowId);

			if(data.status === 1){
				$("#expUserInfoCont").html("");
				var express = data.data;
				var item = "<div class=\"expInfoCont\">\n" +
						"\t\t\t<table>\n" +
						"\t\t\t\t<tr>\n" +
						"\t\t\t\t\t<td>快递公司：</td><td>"+express.companyName+"</td>\n" +
						"\t\t\t\t</tr>\n" +
						"\t\t\t\t<tr>\n" +
						"\t\t\t\t\t<td>快递单号：</td><td>"+express.number+"</td>\n" +
						"\t\t\t\t</tr>\n" +
						"\t\t\t\t<tr>\n" +
						"\t\t\t\t\t<td>快递状态：</td><td>"+express.status+"</td>\n" +
						"\t\t\t\t</tr>\n" +
						"\t\t\t\t<tr>\n" +
						"\t\t\t\t\t<td>取件码：</td><td>"+express.code+"</td>\n" +
						"\t\t\t\t</tr>\n" +
						"\t\t\t</table>\n" +
						"\t\t\t<div class=\"btns\">\n" +
						"\t\t\t\t<button class=\"btn-success\" onclick=\"updateStatus('"+express.number+"',1)\">确认收货</button>\n" +
						"\t\t\t</div>\n" +
						"\t\t</div>";
				$("#expUserInfoCont").append($(item));
			}
		});
	}

	//根据快递单号 确认收货
	function updateStatus(number,type){

		var windowId = layer.load();
		var number = $("#expPickUserId").val();
		$.getJSON("/wx/updateStatus.do",{number:number},function(data){
			layer.msg(data.result);
			$("#expUserInfoCont").html("");
			layer.close(windowId);
			if(type ==0){
				getExpress();
			}
		})

	}

	function getExpress(){
		var windowId = layer.load();
		$.getJSON("wx/findExpressByUserPhone.do",{userPhone:userPhone},function(data){
			if(data.status == -1){
				layer.msg("用户无快递",function(){});
			}else{
				var list = data.data;
				for(var i=0;i<list.length;i++){
					var item = "<div class=\"expInfoCont\">\n" +
							"\t\t\t<table>\n" +
							"\t\t\t\t<tr>\n" +
							"\t\t\t\t\t<td>快递公司：</td><td>"+list[i].companyName+"</td>\n" +
							"\t\t\t\t</tr>\n" +
							"\t\t\t\t<tr>\n" +
							"\t\t\t\t\t<td>快递单号：</td><td>"+list[i].number+"</td>\n" +
							"\t\t\t\t</tr>\n" +
							"\t\t\t\t<tr>\n" +
							"\t\t\t\t\t<td>快递状态：</td><td>"+list[i].status+"</td>\n" +
							"\t\t\t\t</tr>\n" +
							"\t\t\t\t<tr>\n" +
							"\t\t\t\t\t<td>取件码：</td><td>"+list[i].code+"</td>\n" +
							"\t\t\t\t</tr>\n" +
							"\t\t\t</table>\n" +
							"\t\t\t<div class=\"btns\">\n" +
							"\t\t\t\t<button class=\"btn-success\" onclick=\"updateStatus('"+list[i].number+"',0)\">确认收货</button>\n" +
							"\t\t\t</div>\n" +
							"\t\t</div>";
					$("#expUserInfoCont").append($(item));
				}
				layer.close(windowId);
			}
		});
	}
	</script>
	<style type="text/css">
		.expPickCont{
			padding-bottom: 20px;
		}
		.expPickCont .expPickIcon{
			width: 15%;
			margin: 0 auto;
			text-align: center;
		}
		.expPickCont .expPicTitle{
			text-align: center;
			font-weight: bold;
		}

		.searchInfoBtn{
			width: 90%;
			margin: 0 auto;
			text-align: center;
			line-height: 46px;
			border-radius: 23px;
			background: #1f72ff;
			color: #fff;
			font-weight: bolder;
		}

		.expUserInfoCont{
			width: 90%;
			margin: 20px auto 20px; 
			font-size: 14px;
		}
		
		.expUserInfoNull{
			width: 100%;
			line-height: 150px;
			text-align: center;
			color: #888888;
			display: none;
		}
		.expInfoCont{
			width:100%;
			box-sizing: border-box;
			background-color:#fff;
			border-radius: 10px;
			padding: 30px;
		}
		.expInfoCont td:nth-of-type(1){
			text-align: right;
			height:2em;
			line-height: 2em;
		}
		.expInfoCont>.btns{
			border-top: 1px dashed #666;
			padding-top: 20px;
			text-align: right;
			margin-top: 10px;
		}
		.btn-success{
			padding: 5px 15px;
			color: #fff;
			background: #2F9925;
			border: 1px solid #fff;
			border-radius: 5px;
		}
		.status2{
			position: relative;
		}
		.status2_bg{
			position: absolute;
			left:0px;
			top:0px;
			bottom:0px;
			right:0px;
		}
		.status2_bg>img{
			width:30%;
			margin: 0 auto;
			margin-top: 50px;
			opacity: 0.5;
			
		}
		
		
		
		.status1{
			display: inline-block;
		}
		.status2{
			display: none;
		}
	</style>
</head>
<body>
<div class="content">
	<div class="headerNav">
		<div class="headerNavTop"><div class="headerNavIcon headerNavIconOut"><span></span><span></span></div></div>
		<div class="headerNavCont">
			<a href="../../front/view/index.html">快递首页</a>
			<a href="../../front/view/wxUserhome.html">个人中心</a>
			<a href="../../front/view/delivery.html">送货上门</a>
			<a href="../../front/view/lazyboard.html">懒人排行</a>
			<a href="../../front/view/expressAssist.html">快递助手</a>
		</div>
	</div>

	<div class="expPickCont">
		<div class="expPickIcon">
			<img src="../../backend/images/pickexpicon.png" width="100%">
		</div>
		<p class="expPicTitle">确认取货</p>

		<div class="expPickInput">
			<form>
				<input id="PageContext" type="hidden" value="${pageContext.request.contextPath}" />
				<input id="wxCode" type="hidden" value="${wxCode}" />
				<div class="userInputCont">
					<div class="inputTypeCont">
						<div class="inputTitle">快递单号</div>
						<input type="text" id="expPickUserId" class="commonInputFunc" name="username" placeholder="请输入快递单号">
						<div class="commonFuncBtnScan" id="scanQRCodeBtn"></div>
					</div>
				</div>
			</form>
			<div class="searchInfoBtn" id="searchInfoBtn" onclick="find()">查找信息</div>
		</div>
	</div>

	<div class="expUserInfoCont" id="expUserInfoCont">
		<div class="expUserInfoNull">
			暂无查到相关信息
		</div>


	</div>

</div>

</body>
</html>